<?php
/* -------------------------------------------------------------------------------------
* 	ID:						$Id: class.tableBox.php 135 2013-09-22 07:30:55Z phone.mueller@googlemail.com $
* 	Letzter Stand:			$Revision: 135 $
* 	zuletzt geaendert von:	$Author: siekiera $
* 	Datum:					$Date: 2013-09-22 07:30:55 +0000 (Sun, 22 Sep 2013) $
*
* 	SEO:mercari by Siekiera Media
* 	http://www.seo-mercari.de
*
* 	Copyright (c) since 2011 SEO:mercari
* --------------------------------------------------------------------------------------
* 	based on:
* 	(c) 2000-2001 The Exchange Project  (earlier name of osCommerce)
* 	(c) 2002-2003 osCommerce - www.oscommerce.com
* 	(c) 2003     nextcommerce - www.nextcommerce.org
* 	(c) 2005     xt:Commerce - www.xt-commerce.com
*
* 	Released under the GNU General Public License
* ----------------------------------------------------------------------------------- */

class tableBox {
    var $table_border = '0';
    var $table_width = '100%';
    var $table_cellspacing = '0';
    var $table_cellpadding = '';
    var $table_parameters = '';
    var $table_row_parameters = '';
    var $table_data_parameters = '';

    // class constructor
    function tableBox($contents, $direct_output = false) {
      $tableBox_string = '<div';
      if (not_null($this->table_parameters)) 
      	$tableBox_string .= ' ' . $this->table_parameters;
      $tableBox_string .= '>' . "\n";

      for ($i=0, $n=sizeof($contents); $i<$n; $i++) {
        if (isset($contents[$i]['form']) && not_null($contents[$i]['form'])) 
        	$tableBox_string .= $contents[$i]['form'] . "\n";
        	
        $tableBox_string .= '  <div';
        if (not_null($this->table_row_parameters)) 
        	$tableBox_string .= ' ' . $this->table_row_parameters;
        	
        if (isset($contents[$i]['params']) && not_null($contents[$i]['params'])) 
        	$tableBox_string .= ' ' . $contents[$i]['params'];
        	
        $tableBox_string .= '>' . "\n";

        if (is_array($contents[$i][0])) {
          for ($x=0, $n2=sizeof($contents[$i]); $x<$n2; $x++) {
            if (isset($contents[$i][$x]['text']) && not_null($contents[$i][$x]['text'])) {
              $tableBox_string .= '    <div';
             if (isset($contents[$i][$x]['align']) && not_null($contents[$i][$x]['align'])) 
              	$tableBox_string .= ' align="' . $contents[$i][$x]['align'] . '"';
              	
             if (isset($contents[$i][$x]['params']) && not_null($contents[$i][$x]['params'])) {
                $tableBox_string .= ' ' . $contents[$i][$x]['params'];
              } elseif (not_null($this->table_data_parameters)) {
                $tableBox_string .= ' ' . $this->table_data_parameters;
             }
              $tableBox_string .= '>';
              if (isset($contents[$i][$x]['form']) && not_null($contents[$i][$x]['form'])) 
              	$tableBox_string .= $contents[$i][$x]['form'];
              	
              $tableBox_string .= $contents[$i][$x]['text'];
              if (isset($contents[$i][$x]['form']) && not_null($contents[$i][$x]['form'])) 
              	$tableBox_string .= '</form>';
              	
              $tableBox_string .= '</div>' . "\n";
            }
          }
        } else {
          $tableBox_string .= '<div';
          if (isset($contents[$i]['align']) && not_null($contents[$i]['align'])) 
          	$tableBox_string .= ' align="' . $contents[$i]['align'] . '"';
          	
          if (isset($contents[$i]['params']) && not_null($contents[$i]['params'])) {
            $tableBox_string .= ' ' . $contents[$i]['params'];
          } elseif (not_null($this->table_data_parameters)) {
            $tableBox_string .= ' ' . $this->table_data_parameters;
          }
          $tableBox_string .= '>'; 
          $tableBox_string .= $contents[$i]['text']; 
          $tableBox_string .= '</div>' . "\n";
       }

        $tableBox_string .= '  </div>' . "\n";
        if (isset($contents[$i]['form']) && not_null($contents[$i]['form'])) 
        	$tableBox_string .= '</form>' . "\n";
        	
      }

      $tableBox_string .= '</div>' . "\n";

      if ($direct_output == true) 
      	echo $tableBox_string;

      return $tableBox_string;
    }
  }
	
  class indexErrorBox {

    function indexErrorBox($contents, $direct_output = false) {
      $tableBox_string = '<ul style="list-style:none;">';
		for ($i=0, $n=sizeof($contents); $i<$n; $i++) {
			if (is_array($contents[$i][0])) {
				for ($x=0, $n2=sizeof($contents[$i]); $x<$n2; $x++) {
					if (isset($contents[$i][$x]['text']) && not_null($contents[$i][$x]['text'])) {
						$tableBox_string .= $contents[$i][$x]['text'];
					}
				}
			} else {
				$tableBox_string .= $contents[$i]['text']; 
			}
		}
      $tableBox_string .= '</ul>' . "\n";
      if ($direct_output == true) 
      	echo $tableBox_string;
      
      	return $tableBox_string;
    }
  }
?>